import { axios } from '@/utils/requestLeave'

// 登录
export function loginLeave (data) {
  return axios({
    url: '/user/login',
    method: 'post',
    data: data
  })
}
// 查询部门 列表
export function departmentList (data) {
  return axios({
    url: '/department',
    method: 'get',
    params: data
  })
}

// 获取用户列表
export function userList (data) {
  return axios({
    url: '/user/list',
    method: 'get',
    params: data
  })
}

// 查询所有角色
export function roleAll (data) {
  return axios({
    url: '/role/all',
    method: 'get'
  })
}

// 新增用户
export function addUser (data) {
  return axios({
    url: '/user',
    method: 'post',
    data
  })
}

// 重置密码
export function passwordReset (data) {
  return axios({
    url: '/user/password/reset/' + data,
    method: 'post'
  })
}

// 查询所有员工
export function employeeAll (data) {
  return axios({
    url: '/employee/list',
    method: 'get'
  })
}

// 删除用户
export function deleteUser (data) {
  return axios({
    url: '/user/' + data,
    method: 'delete'
  })
}

// 修改用户
export function changeUser (data, value) {
  return axios({
    url: '/user/' + data,
    method: 'put',
    data: value
  })
}

// 查询部门层级信息
export function departmentTree () {
  return axios({
    url: '/department/tree',
    method: 'get'
  })
}

// 添加部门
export function addDepartment (data) {
  return axios({
    url: '/department',
    method: 'post',
    data: data
  })
}

// 获取员工信息
export function employeeList (data) {
  return axios({
    url: '/employee',
    method: 'get',
    params: data
  })
}

// 获取代码项信息
export function codeList (data) {
  return axios({
    url: '/code',
    method: 'get',
    params: data
  })
}

// 修改部门
export function changeDep (data, value) {
  return axios({
    url: '/department/' + data,
    method: 'put',
    data: value
  })
}

// 删除部门
export function deleteDep (data) {
  return axios({
    url: '/department/' + data,
    method: 'delete'
  })
}

// 获取全部代码项列表
export function codeAll (data) {
  return axios({
    url: '/code/list',
    method: 'get',
    params: data
  })
}

// 添加员工
export function addStaff (data) {
  return axios({
    url: '/employee',
    method: 'post',
    data: data
  })
}

// 修改员工
export function changeStaff (data, value) {
  return axios({
    url: '/employee/' + data,
    method: 'put',
    data: value
  })
}

// 删除员工
export function deleteStaff (data) {
  return axios({
    url: '/employee/' + data,
    method: 'delete'
  })
}

// 新增代码项
export function addCode (data) {
  return axios({
    url: '/code',
    method: 'post',
    data: data
  })
}

// 修改代码项
export function changeCode (data) {
  return axios({
    url: '/code',
    method: 'put',
    data
  })
}

// 删除代码项
export function deleteCode (data) {
  return axios({
    url: '/code',
    method: 'delete',
    data
  })
}

// 查询统计
export function applyBusiList (data) {
  return axios({
    url: '/summary',
    method: 'get',
    params: data
  })
}

// 统计列表导出excel
export function exportSummaryExcel (data) {
  return axios({
    url: '/summary/exportSummaryExcel',
    method: 'get',
    responseType: 'blob',
    params: data
  })
}

// 登记归档列表
export function applyBusiListInfo (data) {
  return axios({
    url: '/applyBusi/getRegisterInfos',
    method: 'get',
    data: data
  })
}

// 通过登记/归档
export function submitPassInfo (data) {
  return axios({
    url: '/applyBusi/submitPassInfo?id=' + data,
    method: 'post'
  })
}

//字典标签专用（通过code获取字典数组）
export function ajaxGetDictItems () {
  return axios({
    url: '/applyBusi/getHolidayType',
    method: 'get'
  })
}
